<?php
if(isset($_POST)){
	if(isset($_POST["pageUrl"])){
		$redirectUrl = $_POST["pageUrl"];
		$name = $_POST["packageUnitNameInput"];
		$metricSystemUnitId = $_POST["packageMetricSystemUnitInput"];
		$quantity = $_POST["packageQuantityInput"];
		$package->save($name, $metricSystemUnitId, $quantity);
		header('Location: ' . $redirectUrl);
	} else {
		//TODO: throw exception
		echo "exception";
	}
} else {
	//TODO: throw exception
	echo "exception";
}